import { CharStreams, CommonTokenStream, DefaultErrorStrategy, InputMismatchException, RecognitionException } from "antlr4ts";
import * as fs from "fs";
import { demoLexer } from "./demoLexer";
import { demoParser } from "./demoParser";

// let code = fs.readFileSync("../../test/Main.tscn","utf-8");
// console.log("code",code)
let code="ddd=true";
// 1 解析得到语法树
let inputStream = CharStreams.fromString(code);
let lexer = new demoLexer(inputStream);
let tokenStream = new CommonTokenStream(lexer);
let parser = new demoParser(tokenStream);
// parser.errorHandler = new ErrorD();
let tree = parser.attribute();

console.log("tree",tree.toStringTree());